<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml' xmlns:th='http://www.thymeleaf.org'>
<head>
    <title>登录</title>
    <link rel="stylesheet" type="text/css" th:href="@{/zs/assets/css/login.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/zs/assets/css/reset.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/zs/assets/css/media.css}">
</head>
<body>
<div class="loginbg">
    <div class="login-main">
        <div class="login-banner">
        </div>
        <div class="login-from">
            <ul>
                <li>
                    <h4>后台配置管理员登录</h4>
                </li>
                <li class="login-content">
                    <span>用户名</span>
                    <input type="text" id="name">
                </li>
                <li class="login-content">
                    <span>密　码</span>
                    <input type="password" id="pwd">
                </li>
                <li class="btn btn-primary" type="button" onclick="login()">登录</li>
                <li id="prompt" hidden="hidden">用户名或密码错误！</li>
            </ul>
        </div>
    </div>
</div>
<script type="text/javascript" th:src="@{/zs/assets/js/jquery3.2.1.js}"></script>
<script type="text/javascript" th:src="@{/zs/assets/js/login.js}"></script>
<script>
    function login() {
        var name = $('#name').val();
        var pwd = $('#pwd').val();
        var url = "/zs/auth?name=" + name + "&pwd=" + pwd;
        $.post(url, function (data, status) {
            if (data == 'failed') {
                $('#prompt').show();
            }
            else {
                window.location.href = data;
            }
        });
    }
</script>
</body>
</html>